package gui.mockview;

import gui.batches.AddItemBatchController;
import gui.batches.IAddItemBatchController;
import gui.batches.IAddItemBatchView;
import gui.inventory.ProductContainerData;
import gui.item.ItemData;
import gui.product.ProductData;

import java.util.Date;

public class MockAddView implements IAddItemBatchView {
	
	//data needed to pass to the controller
	private Date entryDate;
	private String count;
	private String barcode;
	private IAddItemBatchController controller;
	
	public MockAddView (ProductContainerData target) {
		entryDate = null;
		count = null;
		barcode = null;
		controller = new AddItemBatchController(this, target);
	}
	
	/**
	 * Force the controller to add an item
	 * */
	public void addItem() {
		this.controller.addItem();
	}
	
	/**
	 * Force the controller to undo the last action
	 * */
	public void undo() {
		this.controller.undo();
	}
	
	/**
	 * Force the controller to redo the last undo action
	 * */
	public void redo() {
		this.controller.redo();
	}
	
	@Override
	public Date getEntryDate() {
		return entryDate;
	}

	@Override
	public void setEntryDate(Date value) {
		this.entryDate = value;
		controller.entryDateChanged();
	}

	@Override
	public String getCount() {
		return count;
	}

	@Override
	public void setCount(String value) {
		this.count = value;
		if (controller != null)
			controller.countChanged();
	}

	@Override
	public void setBarcode(String barcode) {
		this.barcode = barcode;
		controller.barcodeChanged();
	}

	@Override
	public String getBarcode() {
		return barcode;
	}
	
	/*--------------------------------------------------------------------
	 * Unimplemented methods
	 * -----------------------------------------------------------------*/
	@Override
	public void displayInformationMessage(String message) {}
	@Override
	public void displayWarningMessage(String message) {}
	@Override
	public void displayErrorMessage(String message) {}
	@Override
	public void close() {}
	@Override
	public void giveBarcodeFocus() {}
	@Override
	public void setUseScanner(boolean value) {}
	@Override
	public boolean getUseScanner() {return false;}
	@Override
	public void enableItemAction(boolean value) {}
	@Override
	public void enableUndo(boolean value) {}
	@Override
	public void enableRedo(boolean value) {}
	@Override
	public void setProducts(ProductData[] products) {}
	@Override
	public ProductData getSelectedProduct() {return null;}
	@Override
	public void selectProduct(ProductData product) {}
	@Override
	public void setItems(ItemData[] items) {}
	@Override
	public ItemData getSelectedItem() {return null;}
	@Override
	public void selectItem(ItemData item) {}
	@Override
	public void displayAddProductView() {}

}
